﻿#Region "Copyright/License"

'  Copyright (C) 2011, 2012, 2013 Paycircuit.com, Thinking Spot, Ed Chavez
'  http://goo.gl/jty8r
' 
'  Licensed under the Apache License, Version 2.0 (the "License");
'  you may not use this file except in compliance with the License.
'  You may obtain a copy of the License at
' 
'       http://www.apache.org/licenses/LICENSE-2.0
' 
'  Unless required by applicable law or agreed to in writing, software
'  distributed under the License is distributed on an "AS IS" BASIS,
'  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
'  See the License for the specific language governing permissions and
'  limitations under the License.

#End Region

Imports System.Runtime.Serialization

Namespace google.iap

    <DataContract()>
    Public Class InAppItemResponseObject



        ''' <summary>
        ''' A unique identifier for this transaction (this is set by Google on postback)
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        <DataMember(EmitDefaultValue:=True, isRequired:=True)>
        Public Property orderId As String = Nothing

        <DataMember(EmitDefaultValue:=False, isRequired:=False)>
        Public Property statusCode As String = Nothing

        Public Sub New()

        End Sub

        <OnDeserialized()>
        Public Sub validateDeserializedClaim(context As System.Runtime.Serialization.StreamingContext)
            validateClaim()
        End Sub

        <OnSerialized()>
        Public Sub validateSerializedClaim(context As System.Runtime.Serialization.StreamingContext)
            validateClaim()
        End Sub

        Private Sub validateClaim()
            If String.IsNullOrEmpty(Me._orderId) Then
                Throw New NullReferenceException("InAppItemResponseObject orderId is required. InAppItemResponseObject is only instantiated on Google postback and it must contain an Google orderID value.")
            End If
        End Sub

    End Class


End Namespace
